<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<title>v-on 实例</title>
	<script type="text/javascript" src="../assets/js/vue.js"></script>
</head>
<body>
	<h1>v-on 实例</h1>

	<hr>
	<div id="app">
		<p>绑定事件</p>
		本场得分：{{score}}
		<p><button v-on:click="addScore">加分</button></p>
		<p><button @click="minusScore">减分</button></p>
		<input type="text" v-on:keyup.enter="onEnter" v-model="one">
	</div>

</body>
<script type="text/javascript">
var app = new Vue({
	el:'#app',
	data:{
		score:0,
		one:''
	},
	methods:{
		addScore:function () {
			this.score++;
		},
		minusScore:function () {
			this.score--;
		},
		onEnter:function () {
			this.score=this.score+parseInt(this.one);
		}
	}
	
})

</script>
</html>